
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace GlobalLogistics.DAL
{
	public abstract class _Ads : SqlClientEntity
	{
		public _Ads()
		{
			this.QuerySource = "Ads";
			this.MappingName = "Ads";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_AdsLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int AdsID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.AdsID, AdsID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_AdsLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter AdsID
			{
				get
				{
					return new SqlParameter("@AdsID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter EnTitle
			{
				get
				{
					return new SqlParameter("@EnTitle", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter ArTitle
			{
				get
				{
					return new SqlParameter("@ArTitle", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter EnFilePath
			{
				get
				{
					return new SqlParameter("@EnFilePath", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter ArFilePath
			{
				get
				{
					return new SqlParameter("@ArFilePath", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter CategoryID
			{
				get
				{
					return new SqlParameter("@CategoryID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter StartDate
			{
				get
				{
					return new SqlParameter("@StartDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter EndDate
			{
				get
				{
					return new SqlParameter("@EndDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter URL
			{
				get
				{
					return new SqlParameter("@URL", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter AdsLocationID
			{
				get
				{
					return new SqlParameter("@AdsLocationID", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string AdsID = "AdsID";
            public const string EnTitle = "EnTitle";
            public const string ArTitle = "ArTitle";
            public const string EnFilePath = "EnFilePath";
            public const string ArFilePath = "ArFilePath";
            public const string CategoryID = "CategoryID";
            public const string StartDate = "StartDate";
            public const string EndDate = "EndDate";
            public const string URL = "URL";
            public const string AdsLocationID = "AdsLocationID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[AdsID] = _Ads.PropertyNames.AdsID;
					ht[EnTitle] = _Ads.PropertyNames.EnTitle;
					ht[ArTitle] = _Ads.PropertyNames.ArTitle;
					ht[EnFilePath] = _Ads.PropertyNames.EnFilePath;
					ht[ArFilePath] = _Ads.PropertyNames.ArFilePath;
					ht[CategoryID] = _Ads.PropertyNames.CategoryID;
					ht[StartDate] = _Ads.PropertyNames.StartDate;
					ht[EndDate] = _Ads.PropertyNames.EndDate;
					ht[URL] = _Ads.PropertyNames.URL;
					ht[AdsLocationID] = _Ads.PropertyNames.AdsLocationID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string AdsID = "AdsID";
            public const string EnTitle = "EnTitle";
            public const string ArTitle = "ArTitle";
            public const string EnFilePath = "EnFilePath";
            public const string ArFilePath = "ArFilePath";
            public const string CategoryID = "CategoryID";
            public const string StartDate = "StartDate";
            public const string EndDate = "EndDate";
            public const string URL = "URL";
            public const string AdsLocationID = "AdsLocationID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[AdsID] = _Ads.ColumnNames.AdsID;
					ht[EnTitle] = _Ads.ColumnNames.EnTitle;
					ht[ArTitle] = _Ads.ColumnNames.ArTitle;
					ht[EnFilePath] = _Ads.ColumnNames.EnFilePath;
					ht[ArFilePath] = _Ads.ColumnNames.ArFilePath;
					ht[CategoryID] = _Ads.ColumnNames.CategoryID;
					ht[StartDate] = _Ads.ColumnNames.StartDate;
					ht[EndDate] = _Ads.ColumnNames.EndDate;
					ht[URL] = _Ads.ColumnNames.URL;
					ht[AdsLocationID] = _Ads.ColumnNames.AdsLocationID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string AdsID = "s_AdsID";
            public const string EnTitle = "s_EnTitle";
            public const string ArTitle = "s_ArTitle";
            public const string EnFilePath = "s_EnFilePath";
            public const string ArFilePath = "s_ArFilePath";
            public const string CategoryID = "s_CategoryID";
            public const string StartDate = "s_StartDate";
            public const string EndDate = "s_EndDate";
            public const string URL = "s_URL";
            public const string AdsLocationID = "s_AdsLocationID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int AdsID
	    {
			get
	        {
				return base.Getint(ColumnNames.AdsID);
			}
			set
	        {
				base.Setint(ColumnNames.AdsID, value);
			}
		}

		public virtual string EnTitle
	    {
			get
	        {
				return base.Getstring(ColumnNames.EnTitle);
			}
			set
	        {
				base.Setstring(ColumnNames.EnTitle, value);
			}
		}

		public virtual string ArTitle
	    {
			get
	        {
				return base.Getstring(ColumnNames.ArTitle);
			}
			set
	        {
				base.Setstring(ColumnNames.ArTitle, value);
			}
		}

		public virtual string EnFilePath
	    {
			get
	        {
				return base.Getstring(ColumnNames.EnFilePath);
			}
			set
	        {
				base.Setstring(ColumnNames.EnFilePath, value);
			}
		}

		public virtual string ArFilePath
	    {
			get
	        {
				return base.Getstring(ColumnNames.ArFilePath);
			}
			set
	        {
				base.Setstring(ColumnNames.ArFilePath, value);
			}
		}

		public virtual int CategoryID
	    {
			get
	        {
				return base.Getint(ColumnNames.CategoryID);
			}
			set
	        {
				base.Setint(ColumnNames.CategoryID, value);
			}
		}

		public virtual DateTime StartDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.StartDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.StartDate, value);
			}
		}

		public virtual DateTime EndDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.EndDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.EndDate, value);
			}
		}

		public virtual string URL
	    {
			get
	        {
				return base.Getstring(ColumnNames.URL);
			}
			set
	        {
				base.Setstring(ColumnNames.URL, value);
			}
		}

		public virtual int AdsLocationID
	    {
			get
	        {
				return base.Getint(ColumnNames.AdsLocationID);
			}
			set
	        {
				base.Setint(ColumnNames.AdsLocationID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_AdsID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.AdsID) ? string.Empty : base.GetintAsString(ColumnNames.AdsID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.AdsID);
				else
					this.AdsID = base.SetintAsString(ColumnNames.AdsID, value);
			}
		}

		public virtual string s_EnTitle
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EnTitle) ? string.Empty : base.GetstringAsString(ColumnNames.EnTitle);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EnTitle);
				else
					this.EnTitle = base.SetstringAsString(ColumnNames.EnTitle, value);
			}
		}

		public virtual string s_ArTitle
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ArTitle) ? string.Empty : base.GetstringAsString(ColumnNames.ArTitle);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ArTitle);
				else
					this.ArTitle = base.SetstringAsString(ColumnNames.ArTitle, value);
			}
		}

		public virtual string s_EnFilePath
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EnFilePath) ? string.Empty : base.GetstringAsString(ColumnNames.EnFilePath);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EnFilePath);
				else
					this.EnFilePath = base.SetstringAsString(ColumnNames.EnFilePath, value);
			}
		}

		public virtual string s_ArFilePath
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ArFilePath) ? string.Empty : base.GetstringAsString(ColumnNames.ArFilePath);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ArFilePath);
				else
					this.ArFilePath = base.SetstringAsString(ColumnNames.ArFilePath, value);
			}
		}

		public virtual string s_CategoryID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CategoryID) ? string.Empty : base.GetintAsString(ColumnNames.CategoryID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CategoryID);
				else
					this.CategoryID = base.SetintAsString(ColumnNames.CategoryID, value);
			}
		}

		public virtual string s_StartDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.StartDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.StartDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.StartDate);
				else
					this.StartDate = base.SetDateTimeAsString(ColumnNames.StartDate, value);
			}
		}

		public virtual string s_EndDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.EndDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.EndDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.EndDate);
				else
					this.EndDate = base.SetDateTimeAsString(ColumnNames.EndDate, value);
			}
		}

		public virtual string s_URL
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.URL) ? string.Empty : base.GetstringAsString(ColumnNames.URL);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.URL);
				else
					this.URL = base.SetstringAsString(ColumnNames.URL, value);
			}
		}

		public virtual string s_AdsLocationID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.AdsLocationID) ? string.Empty : base.GetintAsString(ColumnNames.AdsLocationID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.AdsLocationID);
				else
					this.AdsLocationID = base.SetintAsString(ColumnNames.AdsLocationID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter AdsID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.AdsID, Parameters.AdsID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter EnTitle
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EnTitle, Parameters.EnTitle);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ArTitle
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ArTitle, Parameters.ArTitle);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter EnFilePath
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EnFilePath, Parameters.EnFilePath);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ArFilePath
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ArFilePath, Parameters.ArFilePath);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CategoryID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CategoryID, Parameters.CategoryID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter StartDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.StartDate, Parameters.StartDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter EndDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.EndDate, Parameters.EndDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter URL
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.URL, Parameters.URL);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter AdsLocationID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.AdsLocationID, Parameters.AdsLocationID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter AdsID
		    {
				get
		        {
					if(_AdsID_W == null)
	        	    {
						_AdsID_W = TearOff.AdsID;
					}
					return _AdsID_W;
				}
			}

			public WhereParameter EnTitle
		    {
				get
		        {
					if(_EnTitle_W == null)
	        	    {
						_EnTitle_W = TearOff.EnTitle;
					}
					return _EnTitle_W;
				}
			}

			public WhereParameter ArTitle
		    {
				get
		        {
					if(_ArTitle_W == null)
	        	    {
						_ArTitle_W = TearOff.ArTitle;
					}
					return _ArTitle_W;
				}
			}

			public WhereParameter EnFilePath
		    {
				get
		        {
					if(_EnFilePath_W == null)
	        	    {
						_EnFilePath_W = TearOff.EnFilePath;
					}
					return _EnFilePath_W;
				}
			}

			public WhereParameter ArFilePath
		    {
				get
		        {
					if(_ArFilePath_W == null)
	        	    {
						_ArFilePath_W = TearOff.ArFilePath;
					}
					return _ArFilePath_W;
				}
			}

			public WhereParameter CategoryID
		    {
				get
		        {
					if(_CategoryID_W == null)
	        	    {
						_CategoryID_W = TearOff.CategoryID;
					}
					return _CategoryID_W;
				}
			}

			public WhereParameter StartDate
		    {
				get
		        {
					if(_StartDate_W == null)
	        	    {
						_StartDate_W = TearOff.StartDate;
					}
					return _StartDate_W;
				}
			}

			public WhereParameter EndDate
		    {
				get
		        {
					if(_EndDate_W == null)
	        	    {
						_EndDate_W = TearOff.EndDate;
					}
					return _EndDate_W;
				}
			}

			public WhereParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public WhereParameter AdsLocationID
		    {
				get
		        {
					if(_AdsLocationID_W == null)
	        	    {
						_AdsLocationID_W = TearOff.AdsLocationID;
					}
					return _AdsLocationID_W;
				}
			}

			private WhereParameter _AdsID_W = null;
			private WhereParameter _EnTitle_W = null;
			private WhereParameter _ArTitle_W = null;
			private WhereParameter _EnFilePath_W = null;
			private WhereParameter _ArFilePath_W = null;
			private WhereParameter _CategoryID_W = null;
			private WhereParameter _StartDate_W = null;
			private WhereParameter _EndDate_W = null;
			private WhereParameter _URL_W = null;
			private WhereParameter _AdsLocationID_W = null;

			public void WhereClauseReset()
			{
				_AdsID_W = null;
				_EnTitle_W = null;
				_ArTitle_W = null;
				_EnFilePath_W = null;
				_ArFilePath_W = null;
				_CategoryID_W = null;
				_StartDate_W = null;
				_EndDate_W = null;
				_URL_W = null;
				_AdsLocationID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter AdsID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.AdsID, Parameters.AdsID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter EnTitle
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EnTitle, Parameters.EnTitle);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ArTitle
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ArTitle, Parameters.ArTitle);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter EnFilePath
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EnFilePath, Parameters.EnFilePath);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ArFilePath
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ArFilePath, Parameters.ArFilePath);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CategoryID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CategoryID, Parameters.CategoryID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter StartDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.StartDate, Parameters.StartDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter EndDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.EndDate, Parameters.EndDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter URL
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.URL, Parameters.URL);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter AdsLocationID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.AdsLocationID, Parameters.AdsLocationID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter AdsID
		    {
				get
		        {
					if(_AdsID_W == null)
	        	    {
						_AdsID_W = TearOff.AdsID;
					}
					return _AdsID_W;
				}
			}

			public AggregateParameter EnTitle
		    {
				get
		        {
					if(_EnTitle_W == null)
	        	    {
						_EnTitle_W = TearOff.EnTitle;
					}
					return _EnTitle_W;
				}
			}

			public AggregateParameter ArTitle
		    {
				get
		        {
					if(_ArTitle_W == null)
	        	    {
						_ArTitle_W = TearOff.ArTitle;
					}
					return _ArTitle_W;
				}
			}

			public AggregateParameter EnFilePath
		    {
				get
		        {
					if(_EnFilePath_W == null)
	        	    {
						_EnFilePath_W = TearOff.EnFilePath;
					}
					return _EnFilePath_W;
				}
			}

			public AggregateParameter ArFilePath
		    {
				get
		        {
					if(_ArFilePath_W == null)
	        	    {
						_ArFilePath_W = TearOff.ArFilePath;
					}
					return _ArFilePath_W;
				}
			}

			public AggregateParameter CategoryID
		    {
				get
		        {
					if(_CategoryID_W == null)
	        	    {
						_CategoryID_W = TearOff.CategoryID;
					}
					return _CategoryID_W;
				}
			}

			public AggregateParameter StartDate
		    {
				get
		        {
					if(_StartDate_W == null)
	        	    {
						_StartDate_W = TearOff.StartDate;
					}
					return _StartDate_W;
				}
			}

			public AggregateParameter EndDate
		    {
				get
		        {
					if(_EndDate_W == null)
	        	    {
						_EndDate_W = TearOff.EndDate;
					}
					return _EndDate_W;
				}
			}

			public AggregateParameter URL
		    {
				get
		        {
					if(_URL_W == null)
	        	    {
						_URL_W = TearOff.URL;
					}
					return _URL_W;
				}
			}

			public AggregateParameter AdsLocationID
		    {
				get
		        {
					if(_AdsLocationID_W == null)
	        	    {
						_AdsLocationID_W = TearOff.AdsLocationID;
					}
					return _AdsLocationID_W;
				}
			}

			private AggregateParameter _AdsID_W = null;
			private AggregateParameter _EnTitle_W = null;
			private AggregateParameter _ArTitle_W = null;
			private AggregateParameter _EnFilePath_W = null;
			private AggregateParameter _ArFilePath_W = null;
			private AggregateParameter _CategoryID_W = null;
			private AggregateParameter _StartDate_W = null;
			private AggregateParameter _EndDate_W = null;
			private AggregateParameter _URL_W = null;
			private AggregateParameter _AdsLocationID_W = null;

			public void AggregateClauseReset()
			{
				_AdsID_W = null;
				_EnTitle_W = null;
				_ArTitle_W = null;
				_EnFilePath_W = null;
				_ArFilePath_W = null;
				_CategoryID_W = null;
				_StartDate_W = null;
				_EndDate_W = null;
				_URL_W = null;
				_AdsLocationID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_AdsInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.AdsID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_AdsUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_AdsDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.AdsID);
			p.SourceColumn = ColumnNames.AdsID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.AdsID);
			p.SourceColumn = ColumnNames.AdsID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.EnTitle);
			p.SourceColumn = ColumnNames.EnTitle;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ArTitle);
			p.SourceColumn = ColumnNames.ArTitle;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.EnFilePath);
			p.SourceColumn = ColumnNames.EnFilePath;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ArFilePath);
			p.SourceColumn = ColumnNames.ArFilePath;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CategoryID);
			p.SourceColumn = ColumnNames.CategoryID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.StartDate);
			p.SourceColumn = ColumnNames.StartDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.EndDate);
			p.SourceColumn = ColumnNames.EndDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.URL);
			p.SourceColumn = ColumnNames.URL;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.AdsLocationID);
			p.SourceColumn = ColumnNames.AdsLocationID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
